1 module mruby.dump; 2 3 import mruby.value; 4 import mruby; 5 import mruby.compile; 6 7 import core.stdc.stdio; 8 9 extern (C): 10 11 struct rite_binary_header 12 { 13 ubyte[4] binary_ident; 14 ubyte[4] binary_version; 15 ubyte[2] binary_crc; 16 ubyte[4] binary_size; 17 ubyte[4] compiler_name; 18 ubyte[4] compiler_version; 19 } 20 21 struct rite_section_header 22 { 23 ubyte[4] section_ident; 24 ubyte[4] section_size; 25 } 26 27 struct rite_section_irep_header 28 { 29 ubyte[4] section_ident; 30 ubyte[4] section_size; 31 ubyte[4] rite_version; 32 } 33 34 struct rite_section_lineno_header 35 { 36 ubyte[4] section_ident; 37 ubyte[4] section_size; 38 } 39 40 struct rite_section_debug_header 41 { 42 ubyte[4] section_ident; 43 ubyte[4] section_size; 44 } 45 46 struct rite_section_lv_header 47 { 48 ubyte[4] section_ident; 49 ubyte[4] section_size; 50 } 51 52 struct rite_binary_footer 53 { 54 ubyte[4] section_ident; 55 ubyte[4] section_size; 56 } 57 58 int mrb_dump_irep (mrb_state* mrb, mrb_irep* irep, ubyte flags, ubyte** bin, size_t* bin_size); 59 int mrb_dump_irep_binary (mrb_state*, mrb_irep*, ubyte, FILE*); 60 int mrb_dump_irep_cfunc (mrb_state* mrb, mrb_irep*, ubyte flags, FILE* f, const(char)* initname); 61 mrb_irep* mrb_read_irep_file (mrb_state*, FILE*); 62 mrb_value mrb_load_irep_file (mrb_state*, FILE*); 63 mrb_value mrb_load_irep_file_cxt (mrb_state*, FILE*, mrbc_context*); 64 mrb_irep* mrb_read_irep (mrb_state*, const(ubyte)*); 65 // int bigendian_p (...); 66 size_t uint8_to_bin (ubyte s, ubyte* bin); 67 size_t uint16_to_bin (ushort s, ubyte* bin); 68 size_t uint32_to_bin (uint l, ubyte* bin); 69 size_t uint32l_to_bin (uint l, ubyte* bin); 70 uint bin_to_uint32 (const(ubyte)* bin); 71 uint bin_to_uint32l (const(ubyte)* bin); 72 ushort bin_to_uint16 (const(ubyte)* bin); 73 ubyte bin_to_uint8 (const(ubyte)* bin); 74 ushort calc_crc_16_ccitt (const(ubyte)* src, size_t nbytes, ushort crc);